home *** CD-ROM | disk | FTP | other *** search
/ PC go! 2008 April / PCgo 2008-04 (DVD).iso / interface / contents / demoversionen_3846 / 13664 / files / Data1.cab / clstoolreg.cls < prev    next >
Encoding:
Visual Basic class definition  |  2004-05-21  |  4.2 KB  |  132 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4.   Persistable = 0  'NotPersistable
  5.   DataBindingBehavior = 0  'vbNone
  6.   DataSourceBehavior  = 0  'vbNone
  7.   MTSTransactionMode  = 0  'NotAnMTSObject
  8. END
  9. Attribute VB_Name = "Regens"
  10. Attribute VB_GlobalNameSpace = False
  11. Attribute VB_Creatable = True
  12. Attribute VB_PredeclaredId = False
  13. Attribute VB_Exposed = True
  14. Option Explicit
  15.  
  16. 'Number of tools in this server
  17. Const NUM_TOOLS = 1
  18. Const gkGraphic = 11
  19. Const gkGroup = 7
  20. 'Toggle this to test loading buttons from .Bmp/.Res
  21. 'Const boolLoadFromBmp As Boolean = False
  22. Const boolDebug As Boolean = False
  23.  
  24. 'Return a description string for this package of tools
  25. Public Property Get Description() As String
  26.     Description = "Insert External Object tool"
  27. End Property
  28.  
  29. 'Called to perform tool function
  30. Public Function Run(ByVal Tool As Object) As Boolean
  31.     Dim objApp As Object
  32.     Dim Drs As Object
  33.     Dim ActDr As Object
  34.     Dim RegMets As Object
  35.  
  36.     'Look for first URL property in the selection
  37.     Set objApp = Tool.Application
  38.     Set ActDr = objApp.ActiveDrawing
  39.     Set Grs = ActDr.Graphics
  40.     Dim Count As Long
  41.     ' get count of Custom Objects (Regen methods)
  42.     Count = Tool.Application.RegenMethods.Count
  43.     Dim i As Integer, k%
  44.     k = 0
  45.     Dim Str1$, Str2$, Str3
  46.     For i = 0 To Count - 1
  47.     Str2 = ""
  48. On Error Resume Next
  49.  
  50.        Str3 = Tool.Application.RegenMethods.Item(i).Type
  51.        If Str3 = imsiAutomation Then
  52.             Str2 = Tool.Application.RegenMethods.Item(i).Description
  53.                     
  54.                     Str1 = Tool.Application.RegenMethods.Item(i).Name
  55.             ' cut some service custom objects from the list
  56.             If Str1 = "HatchWizard.HatchWizard.1" Then
  57.                 GoTo RR
  58.             ElseIf Str1 = "Smart.Connection.1" Then
  59.                 GoTo RR
  60.             ElseIf Str1 = "Viewport.DimensionConnection.1" Then
  61.                 GoTo RR
  62.             ElseIf Str1 = "Foundation.House" Then
  63.                 GoTo RR
  64.             ElseIf Str1 = "AutoDim.House" Then
  65.                 GoTo RR
  66.             ElseIf Str1 = "Schedule.Block" Then
  67.                 GoTo RR
  68.             ElseIf Str1 = "TextAlong.Curve" Then
  69.                 GoTo RR
  70.             ElseIf Str1 = "Fillet3D_Regen.Fillet3D" Then
  71.                 GoTo RR
  72.             Else
  73.                     
  74.                     frmToolReg.List1.List(k) = Str1
  75.                     frmToolReg.List1.ItemData(k) = i
  76.                     k = k + 1
  77.             End If
  78.             
  79.  
  80.         End If
  81. RR:
  82.     Next i
  83.     frmToolReg.List1.Selected(0) = True
  84.     frmToolReg.Show 1
  85.     
  86.     
  87.     Set Grs = Nothing
  88.     Set ActDr = Nothing
  89.     Set RegMets = Nothing
  90.     Set Drs = Nothing
  91.     Set objApp = Nothing
  92.  
  93.     Run = True
  94. End Function
  95.  
  96. 'Fill arrays with information about tools in the package
  97. 'Return the number of tools in the package
  98. Public Function GetToolInfo(CommandNames As Variant, MenuCaptions As Variant, StatusPrompts As Variant, _
  99.     ToolTips As Variant, Enabled As Variant, WantsUpdates As Variant) As Long
  100.     ReDim CommandNames(NUM_TOOLS)
  101.     ReDim MenuCaptions(NUM_TOOLS, 2)
  102.     ReDim StatusPrompts(NUM_TOOLS)
  103.     ReDim ToolTips(NUM_TOOLS)
  104.     ReDim Enabled(NUM_TOOLS)
  105.     ReDim WantsUpdates(NUM_TOOLS)
  106. '    CommandNames(0) = "SDK|Regens"
  107. '    MenuCaptions(0) = "&SDKRegens"
  108.     CommandNames(0) = "&AddOns|S&DK Samples|&Insert|Custom Object2" + "#CMD_SDKCUSTMOBJECT2"
  109.     MenuCaptions(0, 0) = "Custom Object2"
  110.     MenuCaptions(0, 1) = "SDK Samples" ' toolbar name
  111.     StatusPrompts(0) = ""
  112.     ToolTips(0) = "SDK External objects (Regens)"
  113.     Enabled(0) = True
  114.     WantsUpdates(0) = False
  115.     GetToolInfo = NUM_TOOLS
  116. End Function
  117.  
  118.  
  119.  
  120. 'Returns true if tool is correctly initialized
  121. Public Function Initialize(ByVal Tool As Object) As Boolean
  122.     Initialize = True
  123. End Function
  124.  
  125. 'Returns true if tool is correctly initialized
  126. Public Function UpdateToolStatus(ByVal Tool As Object, Enabled As Boolean, Checked As Boolean) As Boolean
  127.     Enabled = True 'Could do a test here to determine whether to disable the button/menu item
  128.     Checked = False  'Could do a test here to determine whether to check the button/menu item
  129.     UpdateToolStatus = True
  130. End Function
  131.  
  132.